import {defineStore} from 'pinia'
import liveApi, { type CategoryItemListType, type ItemListType } from '@/api/homelive'
import type { BannerListType, NavListType } from '@/api/homelive'
/**
 * const bannerList = ref<BannerListType[]>([])
// 楼层的每一项
const floorList = ref<CategoryItemListType[]>([])

const itemList = ref<ItemListType[]>([])
const navList = ref<NavListType[]>([])
 */
interface LiveHomeType{
  bannerList:BannerListType[],
  floorList:CategoryItemListType[],
  itemList:ItemListType[],
  navList:NavListType[]
}
export const useLiveStore = defineStore('liveInfo',{
  state():LiveHomeType {
    return {
      bannerList:[],
      floorList:[],
      itemList:[],
      navList:[]
    }
  },
  actions:{
    async getInitData (id:number){
      const result = await liveApi.getLiveHome(id)
      this.bannerList = result.currentCategory.bannerList
      this.floorList = result.categoryItemList
      this.navList = result.categoryList
    }
  },
  getters:{}
})